Skip to content

perf: cranelift: codegen: optimize RawInst print using fmt::Display - #14078

Merged
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
dishmaker:dishmaker/perf_opt_print_rawinst_display
Aug 6, 2026
Merged

perf: cranelift: codegen: optimize RawInst print using fmt::Display#14078
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
dishmaker:dishmaker/perf_opt_print_rawinst_display

Conversation

@dishmaker

Copy link
Copy Markdown
Contributor

This decreases cargo llvm-lines from 1698144 to 1687711.

Change: -0.61%

Should decrease compile times too.

cargo llvm-lines -p cranelift-codegen -F anyhow,capstone,disas,enable-serde,gimli,host-arch,incremental-cache,postcard,pulley,serde,serde_derive,sha2,std,timing,unwind
Before:
  Lines                  Copies               Function name
  -----                  ------               -------------
  1698144                46552                (TOTAL)
    31987 (1.9%,  1.9%)      1 (0.0%,  0.0%)  cranelift_codegen[8ba54695291ce448]::isa::pulley_shared::inst::generated::print
    27885 (1.6%,  3.5%)      1 (0.0%,  0.0%)  cranelift_codegen[8ba54695291ce448]::isa::x64::lower::isle::generated_code::constructor_lower::<cranelift_codegen[8ba54695291ce448]::machinst::isle::IsleContext<cranelift_codegen[8ba54695291ce448]::isa::x64::lower::isle::generated_code::MInst, cranelift_codegen[8ba54695291ce448]::isa::x64::X64Backend>>

After:
  Lines                  Copies               Function name
  -----                  ------               -------------
  1687711                46552                (TOTAL)
    27885 (1.7%,  1.7%)      1 (0.0%,  0.0%)  cranelift_codegen[8ba54695291ce448]::isa::x64::lower::isle::generated_code::constructor_lower::<cranelift_codegen[8ba54695291ce448]::machinst::isle::IsleContext<cranelift_codegen[8ba54695291ce448]::isa::x64::lower::isle::generated_code::MInst, cranelift_codegen[8ba54695291ce448]::isa::x64::X64Backend>>
    22445 (1.3%,  3.0%)      1 (0.0%,  0.0%)  <cranelift_codegen[8ba54695291ce448]::isa::pulley_shared::inst::generated::RawInstDisplay as core[9cde01f631c9b89d]::fmt::Display>::fmt


rustc -V
rustc 1.99.0-nightly (da86f4d07 2026-07-24)

@dishmaker
dishmaker requested a review from a team as a code owner August 4, 2026 17:46
@dishmaker
dishmaker requested review from alexcrichton and removed request for a team August 4, 2026 17:46
@dishmaker

dishmaker commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Oh. This actually increases llvm-lines on --release by +1.13%

@dishmaker
dishmaker marked this pull request as draft August 4, 2026 18:17
@dishmaker

Copy link
Copy Markdown
Contributor Author

Looks ok for --release too.
It reduces release wasmtime binary .text section by -0.057 %

cargo bloat: from 33.26 MiB to 33.24 MiB

@dishmaker
dishmaker marked this pull request as ready for review August 4, 2026 18:49
@github-actions github-actions Bot added cranelift Issues related to the Cranelift code generator cranelift:meta Everything related to the meta-language. labels Aug 4, 2026
@alexcrichton
alexcrichton added this pull request to the merge queue Aug 6, 2026
Merged via the queue into bytecodealliance:main with commit ac07729 Aug 6, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cranelift:meta Everything related to the meta-language. cranelift Issues related to the Cranelift code generator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants